-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: rate limit peer exchange protocol, enhanced response status in RPC #3035
Conversation
You can find the image built from this PR at
Built from cf4e167 |
…s and desc to the rpc
…sible to set separate limits per protocol. Adjusted mountings. Added and adjusted tests
210332a
to
4b99834
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woow, amazing job! Thanks so much! 😍
Added just some minor questions
waku/common/rate_limit/setting.nim
Outdated
proc translate(sProtocol: string): RateLimitedProtocol = | ||
if sProtocol.len == 0: | ||
return GLOBAL | ||
|
||
case sProtocol | ||
of "global": | ||
return GLOBAL | ||
of "storev2": | ||
return STOREV2 | ||
of "storev3": | ||
return STOREV3 | ||
of "lightpush": | ||
return LIGHTPUSH | ||
of "px": | ||
return PEEREXCHG | ||
of "filter": | ||
return FILTER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we handle the case of a string being passed that doesn't match any of the protocols?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm, yes it worth a double check. Originally invalid strings are filtered with regex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for it! 💯
Just a few comments:)
case sProtocol | ||
of "global": | ||
return GLOBAL | ||
of "storev2": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should instead use the const
items that we already have, such as:
WakuLegacyStoreCodec* = "/vac/waku/store/2.0.0-beta4" |
…C is changed the now respond structure will contain status_code and status_desc.
Latest changes done on the peer-exchange specification is reflected now in nwaku code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. Reviewed for functionality and not detail.
Description
As part of DOS protection for req-res protocols and metrics Waku PeerExchange protocol must be protected just as Lightpush/Store and Filter.
Changes
Warning
The last bullet point introduces a refactored rate limit configuration over CLI/TOML file.
This was necessary as identified different needs for different protocols (out of dogfooding and dashboard data)
This change will break former CLI as removed two former rate-limit option and replaced them by one - formatted string - that can be repeated.
New CLI option is
--rate-limit
which has to be set as string in a proper format.Examples:
--rate-limit="lightpush:13/10s"
--rate-limit="storev3:15/1500ms"
--rate-limit="px:1/1m"
--rate-limit="100/10m"
As this option can be repeated rate limit configuration can be fine-grained for every needs.
How to test
Tests are adjusted and extended. Every peer exchange test must run without error.
Issue
#3028
Further actions: